/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * 
 * need to add library google api client just for data type?
 */
package DataTypes;

import com.google.api.client.util.Key;
import java.util.List;

/**
 *
 * @author thang
 */
public class GoogleApiDataTypes {
    
    public static enum Address_Component_Types{
        @Key
        street_number,           // or street_address
        @Key
        street_address,          //
        @Key
        route,  
        @Key
        locality,               // or political
        @Key
        political,
        @Key
        administrative_area_level_1,    // or political
        @Key
        country,                // or political
        @Key
        postal_code
    }
    
    public static enum Location_type{
        @Key
        ROOFTOP,                // accurate address
        @Key
        RANGE_INTERPOLATED,     // approximation address between two precise points
        @Key
        GEOMETRIC_CENTER,       // geometric center address of a street or region...
        @Key
        APPROXIMATE             // approximate address
    }

    public static enum Status{
        @Key
        OK,                     // no erros, at leat one recod was returned
        @Key
        ZERO_RESULTS,           // no erros, no returned result
        @Key
        OVER_QUERY_LIMIT,       // over quota
        @Key
        REQUEST_DENIED,         // request was denied, often as lack of parameter
        @Key
        INVALID_REQUEST,        // invalid, often as missing parameter
        @Key
        UNKNOWN_ERROR           // server-side error, try again later may be OK
    }

    // place details
    public static class DetailsList{
        @Key 
        public String status;
        @Key
        public PlaceDetails result;
    }
    
    public static class PlaceDetails {
        @Key 
        public String[] types;
        @Key 
        public String formatted_address;
        @Key 
        public List<Address_components> address_components;
        @Key 
        public Geometry geometry;
    }
    
    // Address data type
    public static class AddressList {
        @Key 
        public String status;
        @Key
        public List<Address> results;
    }
    
    public static class Address {
        @Key 
        public String[] types;
        @Key 
        public String formatted_address;
        @Key 
        public List<Address_components> address_components;
        @Key 
        public Geometry geometry;
    }
    
        
    public static class Address_components {
        @Key 
        public String long_name;
        @Key 
        public String short_name;
        @Key 
        public String[] types;
    }        
        
    
    
    // Place and place list data type for using place api
    public static class PlacesList {
        @Key 
        public String status;
        @Key
        public List<Place> results;
    }
    
    public static class Place {
        @Key 
        public String id;
        @Key 
        public String name;
        @Key 
        public String[] types;
        @Key 
        public String reference;
        @Key 
        public Geometry geometry;
        
        @Override
        public String toString() {
            return name + " - " + id + " - " + reference;
        }
    }
    
    public static class Geometry{
        @Key
        public Location location;
        @Key
        public String location_type;
    }
    
    public static class Location{
        @Key
        public double lat;
        @Key
        public double lng;
    }    
}
